package chessmate;

public class Square {

	public int col;
	public int row;
	
	public Square(String coordinate) {
		assert(coordinate.length() == 2);
		char cc = coordinate.charAt(0);
		char rc = coordinate.charAt(1);
		setSquare(cc - 'a',  5- (rc - '1'));
	}//end constructor
	
	public Square(int col, int row){
		setSquare(col, row);
	}//end constructor
	
	public void setSquare(int col, int row){
		assert(col >= 0 && col <= 4);
		assert(row >= 0 && row <= 5);
		this.col = col;
		this.row = row;
	}//end method
	
	public String toString() {
		return String.valueOf((char)(col + 'a')) + String.valueOf((char)('6'-row));
	}//end method
	
}//end class
